package com.hyh.textMessage.config;


import com.hyh.textMessage.constants.PayConstants;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MqConfig {
    @Bean
    public TopicExchange topicExchange(){
        return new TopicExchange(PayConstants.PAY_EXCHANGE_NUMBER, true, false);
    }

    @Bean
    public Queue payQueue(){
        return new Queue(PayConstants.PAY_QUEUE_NUMBER,true);
    }

    @Bean
    public Binding Updatebinding(){
        return BindingBuilder
                .bind(payQueue())
                .to(topicExchange())
                .with(PayConstants.PAY_ROUTING_KEY_NUMBER);
    }
}
